using System;

namespace Kodefabrikken.DDD.Entity
{
    public static class ObjectExtensions
    {
        public static void AssertOfType<T>(this object obj)
        {
            if (!(obj is T))
            {
                throw new Exception("this is not of expected type");
            }
        }

        public static bool IsSameType(this object obj, object other)
        {
            if (other == null)
            {
                return false;
            }

            return obj.GetType().Equals(other.GetType());
        }
    }
}
